home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / M / LSP⁄C.cpt / Init.p < prev    next >
Text File  |  1989-01-05  |  3KB  |  151 lines

  1. UNIT INIT;
  2.  
  3. INTERFACE
  4.  
  5.     USES
  6.         GLOBALS;
  7.  
  8.     PROCEDURE Init_Mac (exit_proc: ProcPtr);
  9.  
  10.     PROCEDURE MakeMenus;
  11.  
  12.     PROCEDURE MakeWindow;
  13.  
  14. IMPLEMENTATION
  15.  
  16.     PROCEDURE Init_Mac;
  17.     BEGIN
  18.         MaxApplZone;
  19.         MoreMasters;
  20.         MoreMasters;
  21.         MoreMasters;
  22.         MoreMasters;
  23.         InitGraf(@thePort);
  24.         InitFonts;
  25.         FlushEvents(everyEvent, 0);
  26.         InitWindows;
  27.         InitMenus;
  28.         TEInit;
  29.         InitDialogs(exit_proc);
  30.         InitCursor;
  31.  
  32.         cTime := 0;
  33.         crTime := 0;
  34.         pTime := 0;
  35.  
  36.         perfIndex := TO_P_FUNCTION;
  37.  
  38.         cPerf := 0.0;
  39.         crPerf := 0.0;
  40.         pPerf := 0.0;
  41.     END;
  42.  
  43.     PROCEDURE MakeMenus;
  44.         VAR
  45.             iStr: Str255;
  46.             mValue: Longint;
  47.             spacePos: Integer;
  48.     BEGIN
  49.         appleMenu := GetMenu(APPLEID);
  50.         AddResMenu(appleMenu, 'DRVR');
  51.         InsertMenu(appleMenu, 0);
  52.  
  53.         fileMenu := GetMenu(FILEID);
  54.         InsertMenu(fileMenu, 0);
  55.  
  56.         DisableItem(fileMenu, 4);
  57.         DisableItem(fileMenu, 7);
  58.         DisableItem(fileMenu, 10);
  59.  
  60.  
  61.         DisableItem(fileMenu, NEWITEM);
  62.         DisableItem(fileMenu, OPENITEM);
  63.         DisableItem(fileMenu, CLOSEITEM);
  64.         DisableItem(fileMenu, SAVEITEM);
  65.         DisableItem(fileMenu, SAVEASITEM);
  66.         DisableItem(fileMenu, PAGESETUPITEM);
  67.         DisableItem(fileMenu, PRINTITEM);
  68.  
  69.         editMenu := GetMenu(EDITID);
  70.         InsertMenu(editMenu, 0);
  71.  
  72.         DisableItem(editMenu, 7);
  73.  
  74.         compareMenu := GetMenu(COMPAREID);
  75.         InsertMenu(CompareMenu, 0);
  76.         DisableItem(compareMenu, 3);
  77.  
  78.         pointerMenu := GetMenu(POINTERID);
  79.         InsertMenu(pointerMenu, -1);
  80.  
  81.         loopMenu := GetMenu(LOOPID);
  82.         InsertMenu(loopMenu, -1);
  83.  
  84.         CheckItem(loopMenu, 1, TRUE);
  85.         GetItem(loopMenu, 1, iStr);
  86.         StringToNum(iStr, mValue);
  87.         numLoops := Integer(mValue);
  88.  
  89.         CheckItem(pointerMenu, 1, TRUE);
  90.         GetItem(pointerMenu, 1, iStr);
  91.         spacePos := pos(' ', iStr);
  92.         delete(iStr, spacePos, length(iStr) - spacePos + 1);
  93.  
  94.         StringToNum(iStr, mValue);
  95.         pSize := mValue;
  96.  
  97.         SetItemCmd(compareMenu, 1, CHAR(hMenuCmd));
  98.         SetItemMark(compareMenu, 1, CHAR(POINTERID));
  99.  
  100.         SetItemCmd(compareMenu, 2, CHAR(hMenuCmd));
  101.         SetItemMark(compareMenu, 2, CHAR(LOOPID));
  102.  
  103.         DrawMenuBar;
  104.     END;
  105.  
  106.     PROCEDURE MakeWindow;
  107.         VAR
  108.             r: Rect;
  109.             tRect: Rect;
  110.             cRect: Rect;
  111.             index: Integer;
  112.             wTitle: Str255;
  113.     BEGIN
  114.         SetRect(r, 40, 60, 480, 60 + 120);
  115.         wTitle := 'Pascal • C Comparison';
  116.  
  117.         theWindow := NewWindow(NIL, r, wTitle, FALSE, 4, WindowPtr(-1), TRUE, 0);
  118.  
  119.         SetPort(theWindow);
  120.         TextFont(3);
  121.         TextSize(9);
  122.         TextMode(srcCopy);
  123.  
  124.         cRect := theWindow^.portRect;
  125.         WITH cRect DO
  126.             BEGIN
  127.                 right := right - 4;
  128.                 top := top + 4;
  129.                 left := right - 80;
  130.                 bottom := top + 20;
  131.             END;
  132.  
  133.         do_it := NewControl(theWindow, cRect, 'Do It!', TRUE, 0, 0, 1, 0, 0);
  134.  
  135.         SetRect(ptrSizeDst, 110, 8, 162, 22);
  136.         SetRect(loopSizeDst, 200, 8, 232, 22);
  137.  
  138.         SetRect(cTimeDst, 160, 56, 242, 70);
  139.         SetRect(crTimeDst, 160, 74, 242, 88);
  140.         SetRect(pTimeDst, 160, 92, 242, 106);
  141.  
  142.         SetRect(cPerfDst, 280, 54, 410, 70);
  143.         SetRect(crPerfDst, 280, 74, 410, 88);
  144.         SetRect(pPerfDst, 280, 92, 410, 106);
  145.  
  146.         CenterWindow(theWindow, screenBits.bounds);
  147.         ShowWindow(theWindow);
  148.  
  149.     END;
  150.  
  151. END.